﻿using System;
using System.Windows.Input;
using Hopscotch.Presentation.Common;
using Hopscotch.Presentation.DiagnosticsModule.Views;
using Microsoft.Practices.Prism.Regions;
using Microsoft.Practices.ServiceLocation;
using Microsoft.Practices.Unity;

namespace Hopscotch.Presentation.DiagnosticsModule.Commands
{

    public class ShowDiagnosticsModuleCommand : ICommand
    {
        public bool CanExecute(object parameter)
        {
            return true;
        }

        public event EventHandler CanExecuteChanged
        {
            add { }
            remove { }
        }

        public void Execute(object parameter)
        {
            // Initialize
            var regionManager = ServiceLocator.Current.GetInstance<IRegionManager>();

            var container = ServiceLocator.Current.GetInstance<IUnityContainer>();
            var view = container.Resolve<SystemDiagnosticsView>();
            regionManager.AddToRegion(RegionNames.WorkspaceRegion, view);
        }
    }
}
